package copy;


import java.io.IOException;
import java.util.ArrayList;

public class ClientHander implements Runnable {
	private Clienter client;
	private ArrayList<Clienter> clientList;
	public ClientHander() {
		super();
	}
	public ClientHander(Clienter clen,ArrayList<Clienter> list) {
		client=clen;
		clientList=list;
	}
	public void run() {
		String info=null;
		try {
			while((info=client.getBr().readLine())!=null) {
				
				//判断是否是第一次输入，是第一次输入就是昵称赋值给当前对象的nikeName
				
				//如果含有@表明是对莫人的私聊，就单独发给莫人
				
				//群聊每个客户端都发一边
							
				System.out.println("22222");
				this.client.getPw().println("说："+info);
				ArrayList<User> users=new ArrayList<>();
				users.add(new User(1,"zhangsan"));
				users.add(new User(2,"李四" ));
				this.client.getOos().writeObject(users);
//				this.client.getOos().writeObject(new String("去四"));
				client.getPw().println(this.client.getNikeName()+"说："+info);
//				this.client.getOos().flush();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
